/*
 * AddFrame.java
 *
 * Created on 27 ottobre 2008, 11.41
 */

package lpr.minikazaa.test.GUI;

/**
 *
 * @author  giovine
 */
public class AddFrame extends javax.swing.JFrame {
    SharedDataStructure shared;
    GuiTest gui;
    /** Creates new form AddFrame */
    public AddFrame(SharedDataStructure s, GuiTest g) {
        this.shared = s;
        this.gui = g;
        initComponents();

        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        add_tf = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        add_tf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                add_tfActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(59, 59, 59)
                .addComponent(add_tf, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(68, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(add_tf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(55, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void add_tfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_add_tfActionPerformed
    this.shared.addElement(add_tf.getText());
    this.gui.addElement(this.shared.getVariable().indexOf(add_tf.getText()));
    this.add_tf.setText("");
}//GEN-LAST:event_add_tfActionPerformed



    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField add_tf;
    // End of variables declaration//GEN-END:variables

}
